🌎 rns.kin.earth git 🌍
Commit f55004a574aecd11f31e2d0a54bca11c70db9934
Parents : d002a75
Author : Tristan B. Velloza Kildaire <deavmi@redxen.eu>
Signature : Signature validation error
Date : 2024-11-03T17:54:59+02:00
Committer : GitHub <noreply@github.com>
Date : 2024-11-03T17:54:59+02:00
Allow binding to IPv6 (if present)
If an interface has an IPv6 address record associated with it then, and only then, prefer that.
Otherwise AF_INET is used (Ipv4 address)
Changes
Diff
diff --git a/RNS/Interfaces/TCPInterface.py b/RNS/Interfaces/TCPInterface.py
index 54eadb01..2c6a0362 100644
--- a/RNS/Interfaces/TCPInterface.py
+++ b/RNS/Interfaces/TCPInterface.py
@@ -412,6 +412,11 @@ class TCPServerInterface(Interface):
def get_address_for_if(name):
import RNS.vendor.ifaddr.niwrapper as netinfo
ifaddr = netinfo.ifaddresses(name)
+
+ # IPv6 preference (if present)
+ if(netinfo.AF_INET6 in ifaddr):
+ return ifaddr[netinfo.AF_INET6][0]["addr"]
+
return ifaddr[netinfo.AF_INET][0]["addr"]
@staticmethod
Served by rngit 1.5.2 - Generated in 0.03s